.\" Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
.\" Use is subject to license terms.
.\"
.\" CDDL HEADER START
.\"
.\" The contents of this file are subject to the terms of the
.\" Common Development and Distribution License (the "License").
.\" You may not use this file except in compliance with the License.
.\"
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
.\" or http://www.opensolaris.org/os/licensing.
.\" See the License for the specific language governing permissions
.\" and limitations under the License.
.\"
.\" When distributing Covered Code, include this CDDL HEADER in each
.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
.\" If applicable, add the following below this CDDL HEADER, with the
.\" fields enclosed by brackets "[]" replaced with your own identifying
.\" information: Portions Copyright [yyyy] [name of copyright owner]
.\"
.\" CDDL HEADER END
.\"
.TH JSTYLE 1ONBLD "Feb 22, 2017"
.SH NAME
.I jstyle
\- check for some common stylistic errors in Java source files
.SH SYNOPSIS
\fBjstyle [-chptvC] [file...]\fP
.SH DESCRIPTION
.LP
.B jstyle
inspects Java source files (*.java) for common stylistic errors.  It
is similar to
.BR cstyle (1ONBLD)
in that it attempts to check for the style
documented in \fIcstyle.ms.pdf\fP, although by
necessity is modified to work with Java-specific constructs.  Note that
there is much in that document that
.I cannot
be checked for; just because your code is
.BR jstyle (1ONBLD)
clean does not
mean that you've followed illumos Java style.  \fICaveat emptor\fP.
.SH OPTIONS
.LP
The following options are supported:
.TP 4
.B \-c
Check continuation line indentation inside of functions.  illumos C style
states that all statements must be indented to an appropriate tab stop,
and any continuation lines after them must be indented \fIexactly\fP four
spaces from the start line.  This option enables a series of checks
designed to find continuation line problems within functions only.
.TP 4
.B \-h
Performs heuristic checks that are sometimes wrong.  Not generally used.
.TP 4
.B \-p
Performs some of the more picky checks.  You should generally use this.
.TP 4
.B \-t
Insists on indentation with tabs.  Because of the depth of nested blocks
that Java requires, and the commonality of long identifiers, tab
indentation in Java code is not always useful, assuming that tabs are fixed
at eight columns and that maximum line length is fixed at eighty columns,
so this option is not on by default.  If you choose to consider tabs to be
four columns wide (not acceptable for ON), or are writing simple enough
code that the nesting is not very deep, this option might be useful.
Otherwise, avoid it.
.TP 4
.B \-v
Verbose output; includes the text of the line of error.
.TP 4
.B \-C
Ignore errors in header comments (i.e., block comments starting in the
first column).  Not generally used.
.SH NOTES
.LP
The jstyle rule for the illumos gate is that all new files must
be
.B -p
clean.  For existing files, the following invocations are
run against both the old and new files:
.TP 4
.B "jstyle file"
.TP 4
.B "jstyle -p file"
.LP
If the old file gave no errors for one of the invocations, the new file
must also give no errors.  This way, files cannot become unclean.
.SH BUGS
.LP
.BR jstyle (1ONBLD)
cannot disambiguate Java generic type parameters or
arguments that span multiple lines from relational operators.  For example:
.RS 4
.HP 4
private class Foo<A extends Bar,
.br
B extends Bar> { ...
.RE
.LP
is flagged as two lines with missing spaces around relational operators.
